<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="zh-CN">
<%    
String path = request.getContextPath();    
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";    
pageContext.setAttribute("basePath",basePath);    
%> 
<head>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
    <title>用户管理</title>
    <link href="<%=basePath%>resources/js/bootstrap-3.3.6-dist/css/bootstrap.min.css" rel="stylesheet" media="screen">
    <link href="<%=basePath%>resources/css/style.css" rel="stylesheet" type="text/css">
    <link href="<%=basePath%>resources/css/media.css" rel="stylesheet" type="text/css">
    <script src="<%=basePath%>resources/js/jquery-1.9.1.min.js"></script>
    <script src="<%=basePath%>resources/js/bootstrap-3.3.6-dist/js/bootstrap.min.js"></script>
     <script src="<%=basePath%>resources/js/bootstrap-3.3.6-dist/js/html5shiv.min.js"></script>
    <script src="<%=basePath%>resources/js/bootstrap-3.3.6-dist/js/respond.min.js"></script>
    <style>
    	.userInfoDiv{
			width: 100%;
		}
		.userInfoDiv td{
			height: 50px;
		}
	</style>
</head>
<body style="height:100%;width:100%">
<img src="<%=basePath%>resources/images/background.jpg" class='golbal_bakcground' style="z-index: 1;height:100%"/>

		<div class="golbal_div" style="z-index: 3;">
		<jsp:include page="./../leftMenu.jsp"></jsp:include>
		<div style="padding:0 15px;width:1080px;margin:0 auto;color:white">当前位置：智能家居后台管理系统>><a href="javascript:location.reload();" style="color:currentColor">用户管理</a></div>
		
			<div class="big_right_div">
					<div class="infoDiv" id="rightDiv">
					<table style="width: 100%;">
							<tr style="height:60px">
								<td>
									<form action="index.html" method="post">
										<table>
											<tr>
												<td>&nbsp;&nbsp;&nbsp;&nbsp;用户名:</td>
												<td>
													<input type='text' name='userName' value='${userName }' class="form-control" style="width: 150px;margin:0 20px"/>
												</td>
												<td>性&nbsp;&nbsp;别:</td>
												<td>
													<select name='searchSex' class="form-control" style="width: 150px;margin-left:20px">
													<option ></option>
													<option value='男' <c:if test='${searchSex=="男" }'>selected=selected </c:if > >男</option>
													<option value='女' <c:if test='${searchSex=="女" }'>selected=selected </c:if > >女</option>
													</select>
												</td>
												<td>
													<input type='submit' value='查询' class="btn btn-primary" style="margin:0 30px">
												</td>
												<td>
													<input type='button' value='新增'  onclick="toAddIndex();" class="btn btn-primary"/>
												</td>
											</tr>
										</table>	
									</form>
								</td>
							</tr>
					
							<tr>
								<td style="width: 100%;">
									<table class="table table-hover table-bordered" id="listTable" style="width: 100%;">
										<thead>
											<tr>
												<th>用户名</th>
												<th>性别</th>
												<th>电话</th>
												<th>部门</th>
												<th>角色</th>
												<th>操作</th>
											</tr>
										</thead>
										<tbody>
											<c:forEach items="${infoList }" var="v" varStatus="vs">
												<tr>
													<td>${v.name }</td>
													<td>${v.sex }</td>
													<td>${v.phone }</td>
													<td>${v.department.name }</td>
													<td>${v.role.name }</td>
													<td>
														<button onclick="goUpdate('${v.id}');" class="btn btn-primary" style="color:yellow" title="修改"><span class="glyphicon glyphicon-pencil"></span></button>
														<button onclick='resetPassword("${v.id}");' class="btn btn-primary" title="重置密码" style="margin:0 20px"><span class="glyphicon glyphicon-repeat"></span></button>
														<button onclick="goDelete('${v.id}');" class="btn btn-primary"  style="color:red" title="删除"><span class="glyphicon glyphicon-remove"></span></button>
													</td>
												</tr>		
											</c:forEach>
										</tbody> 	
									</table>
								</td>
							</tr>		
						</table>
					<div><jsp:include page="../page/bootstrapPager.jsp"></jsp:include></div>
					</div>
							
			</div>
		</div>
		<div class="copyright_div" style="z-index: 2;">
			<p style="color: white;">
				Copyright©2016<br/>  
				智能家居版权所有
			</p>
		</div>

	
	
<script type="text/javascript">
	
	function toAddIndex(){
		window.location.href = 'addUserIndex.html' ;
	}
	
	function goUpdate(userId){
		window.location.href = "addUserIndex.html?oldId="+userId ;
	}
	
	function goDelete(userId){
		if(confirm('确定要删除么?')){
			window.location.href = 'deleteUser.html?id='+userId ;
		}
	}
	
	function resetPassword(userId){
		if(confirm('确定要重置密码么?')){
			window.location.href = 'resetPassword.html?id='+userId ;
		}
	}
</script>


<script>
$(document).ready(function() {  
	$("#menu1").removeClass().addClass("list-group-item active");  
})
</script>

</body>
</html>
